<pre class="docs-method-signature"><code>path.closestPointTangent(point [, opt])</code></pre>
<p>Return a line that is tangent to the path at the point that lies closest to <code>point</code>.</p>

<p>If the identified closest point is a point of discontinuity (e.g. it is a point shared by two Lineto segments with different slopes), the tangent line is constructed for the earlier segment (i.e. the segment closer to the beginning of the path).</p>

<p>The tangent line starts at the identified closest point. The direction from <code>start</code> to <code>end</code> is the same as the direction of the curve at the closest point.</p>

<p>The algorithm skips over segments that are not differentiable. This includes all invisible segments (e.g. Moveto segments) and visible segments with zero length. If the path contains no valid segments, <code>null</code> is returned. If the path has no segments at all, <code>null</code> is returned, as well. The <code>segment.isDifferentiable()</code> functions may be used to determine whether a given segment is valid; the <code>path.isDifferentiable()</code> <a href="#g.Path.prototype.isDifferentiable">function</a> may be used to determine whether the path contains at least one valid segment.</p>

<p>The function finds a valid segment whose identified closest point lies at the lowest distance from <code>point</code>. It then finds a tangent to the segment at the identified closest point.</p>

<p>The <code>opt</code> argument is optional. Two properties may be specified, <code>opt.precision</code> and <code>opt.segmentSubdivisions</code>, which determine maximum error allowed in segment <code>closestPoint</code> calculations for curved segments (default precision is 3; this corresponds to maximum observed error of 0.1%). The <code>opt.segmentSubdivisions</code> property is an array of individual segments' <a href="#g.Curve.prototype.getSubdivisions">subdivision arrays</a>. The <code>path.getSegmentSubdivisions()</code> <a href="#g.Path.prototype.getSegmentSubdivisions">function</a> may be used to obtain the <code>segmentSubdivisions</code> array. The <code>opt.precision</code> property is still necessary, however; it determines the precision of the point search algorithm in curved segments.</p>
